package com.tbynet.jwp.service.dto.imports;

import java.util.ArrayList;
import java.util.List;

/**
 * 导入结果
 */
public class ImportResult {
    private boolean success = false;
    private String errorMessage;
    private int importedCount = 0;
    private int errorCount = 0;
    private List<String> errors = new ArrayList<>();

    // 构造函数
    public ImportResult() {
    }

    public ImportResult(boolean success, String errorMessage) {
        this.success = success;
        this.errorMessage = errorMessage;
    }

    // 业务方法
    public void incrementImportedCount() {
        this.importedCount++;
    }

    public void addError(String error) {
        this.errors.add(error);
        this.errorCount++;
    }

    // Getters and Setters
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public int getImportedCount() {
        return importedCount;
    }

    public void setImportedCount(int importedCount) {
        this.importedCount = importedCount;
    }

    public int getErrorCount() {
        return errorCount;
    }

    public void setErrorCount(int errorCount) {
        this.errorCount = errorCount;
    }

    public List<String> getErrors() {
        return errors;
    }

    public void setErrors(List<String> errors) {
        this.errors = errors;
        this.errorCount = errors != null ? errors.size() : 0;
    }
}